package cn.le.api;

import cn.le.dto.DeviceDTO;
import cn.le.dto.ProductDTO;
import cn.le.service.DeviceService;
import cn.le.util.ResponseFactory;
import cn.le.vo.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@Api(value = "设备功能")
@RestController
@RequestMapping(value = "/api/device")
public class DeviceApi {

    @Autowired
    private DeviceService deviceService;

    @ApiOperation(value = "新增设备",notes = "新增设备")
    @RequestMapping(value = "add",method = RequestMethod.POST)
    public ResponseVO add(@RequestBody @Valid DeviceDTO dto){
        deviceService.add(dto);
        return ResponseFactory.ok("添加成功");
    }

    @ApiOperation(value = "get",notes = "get")
    @RequestMapping(value = "get",method = RequestMethod.GET)
    public ResponseVO get(){
        //deviceService.add(dto);
        return ResponseFactory.ok("get");
    }




}
